package com.lyc.day1104.demo02;

import java.util.function.Supplier;

/**
 * @author ：Xiaochen
 * @date ：Created in 2022/11/4 19:59
 * @description：
 * @modified By：
 * @version:
 */
public class Test03 {
    public static void main(String[] args) {
        Student s = new Student("小诗诗", 16);

        Supplier<String> supplier=s::getName;
        System.out.println(supplier.get());
    }
}

class Student{
    private String name;
    private Integer age;

    public Student(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

